Skip to content

Create taurus09318976.py #1668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 15, 2025
Merged

Conversation

taurus09318976
Copy link
Contributor

@taurus09318976 taurus09318976 commented Jul 12, 2025

답안 제출 문제

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

Copy link
Contributor

@printjin-gmailcom printjin-gmailcom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

마지막 주차까지 정말 고생 많으셨습니다! 😊
주석으로 꼼꼼히 설명해주신 부분들이 많아 작성하시느라 꽤나 수고가 많으셨을 텐데 덕분에 코드도 훨씬 이해하기 쉽고 보기 좋았습니다. 저도 덕분에 많이 배우고 갑니다.

root_val = preorder[0]
root = TreeNode(root_val)

# 3. inorder에서 루트 위치 찾기
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O(n)이므로 전체 시간복잡도 증가 → 인덱스 맵(dict) 사전 생성 추천

left_inorder = inorder[:root_index]
right_inorder = inorder[root_index + 1:]

# 5. preorder도 해당 크기만큼 분할
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매번 리스트 복사 발생 → 인덱스 범위로 재귀 호출하면 성능 개선 가능

@printjin-gmailcom printjin-gmailcom merged commit 53ce7c7 into DaleStudy:main Jul 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Solving
Development

Successfully merging this pull request may close these issues.

2 participants